#!/bin/bash

SCRIPT_DIR=$(cd `dirname $0` && pwd)
cd $SCRIPT_DIR

mkdir -p ../../build/yi-hack/bin/
mkdir -p ../../build/yi-hack/sbin/

arm-openwrt-linux-strip ./_install/dropbearmulti
rsync -a ./_install/dropbearmulti ../../build/yi-hack/bin/

# fat32 doesn't support symbolic links
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/bin/dbclient
chmod 0755 ../../build/yi-hack/bin/dbclient
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/bin/dropbearconvert
chmod 0755 ../../build/yi-hack/bin/dropbearconvert
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/bin/dropbearkey
chmod 0755 ../../build/yi-hack/bin/dropbearkey
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/bin/scp
chmod 0755 ../../build/yi-hack/bin/scp
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/bin/ssh
chmod 0755 ../../build/yi-hack/bin/ssh
echo "#!/tmp/sd/yi-hack/bin/dropbearmulti" > ../../build/yi-hack/sbin/dropbear
chmod 0755 ../../build/yi-hack/sbin/dropbear
